home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / polardrw / data.z / DrawOcxTestDoc.cpp < prev    next >
C/C++ Source or Header  |  1999-04-13  |  3KB  |  118 lines

  1. // DrawOcxTestDoc.cpp : implementation of the CDrawOcxTestDoc class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "DrawOcxTest.h"
  6.  
  7. #include "DrawOcxTestDoc.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CDrawOcxTestDoc
  18.  
  19. IMPLEMENT_DYNCREATE(CDrawOcxTestDoc, CDocument)
  20.  
  21. BEGIN_MESSAGE_MAP(CDrawOcxTestDoc, CDocument)
  22.     //{{AFX_MSG_MAP(CDrawOcxTestDoc)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CDrawOcxTestDoc construction/destruction
  30.  
  31. CDrawOcxTestDoc::CDrawOcxTestDoc()
  32. {
  33.     // TODO: add one-time construction code here
  34.    m_strDocumentName = "";
  35.  
  36. }
  37.  
  38. CDrawOcxTestDoc::~CDrawOcxTestDoc()
  39. {
  40. }
  41.  
  42. BOOL CDrawOcxTestDoc::OnNewDocument()
  43. {
  44.     if (!CDocument::OnNewDocument())
  45.         return FALSE;
  46.  
  47.     // TODO: add reinitialization code here
  48.     // (SDI documents will reuse this document)
  49.  
  50.     return TRUE;
  51. }
  52.  
  53.  
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CDrawOcxTestDoc serialization
  57.  
  58. void CDrawOcxTestDoc::Serialize(CArchive& ar)
  59. {
  60.     if (ar.IsStoring())
  61.     {
  62.         // TODO: add storing code here
  63.     }
  64.     else
  65.     {
  66.         // TODO: add loading code here
  67.     }
  68. }
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CDrawOcxTestDoc diagnostics
  72.  
  73. #ifdef _DEBUG
  74. void CDrawOcxTestDoc::AssertValid() const
  75. {
  76.     CDocument::AssertValid();
  77. }
  78.  
  79. void CDrawOcxTestDoc::Dump(CDumpContext& dc) const
  80. {
  81.     CDocument::Dump(dc);
  82. }
  83. #endif //_DEBUG
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CDrawOcxTestDoc commands
  87.  
  88. BOOL CDrawOcxTestDoc::OnOpenDocument(LPCTSTR lpszPathName) 
  89. {
  90.     if (!CDocument::OnOpenDocument(lpszPathName))
  91.         return FALSE;
  92.     
  93.    // We do nothing here, just remember the name of the file to be open.
  94.    // Real job is done in CDrawOcxTestView::OnInitialUpdate()
  95.    m_strDocumentName = lpszPathName;
  96.     
  97.     return TRUE;
  98. }
  99.  
  100. BOOL CDrawOcxTestDoc::OnSaveDocument(LPCTSTR lpszPathName) 
  101. {
  102.    //return CDocument::OnSaveDocument(lpszPathName);
  103.    m_strDocumentName = lpszPathName;
  104.    POSITION pos = GetFirstViewPosition();
  105.    if (pos != NULL)
  106.    {
  107.       CView* pView = GetNextView(pos);
  108.       pView->SendMessage(WM_SAVEDOCUMENT, (WPARAM)0, (LPARAM)0);
  109.    }      
  110.     
  111.     return TRUE; 
  112. }
  113.  
  114. CString CDrawOcxTestDoc::GetDocumentName()
  115. {
  116.    return m_strDocumentName;
  117. }
  118.